//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core.Serialization;

namespace OpenLS.Drawing
{
    internal class TextNormalAutofit : TextAutofit
    {
        private int fontScale = 100000;

        private int lnSpcReduction;

        public int FontScale
        {
            get { return fontScale; }
            set { fontScale = value; }
        }

        public int LineSpaceReduction
        {
            get { return lnSpcReduction; }
            set { lnSpcReduction = value; }
        }


        internal override void ReadXmlCore(ReadContext context)
        {
            using (var c = context.Read("normAutofit"))
            {
                FontScale = c.GetOptionalInteger("fontScale", 100000);
                LineSpaceReduction = c.GetOptionalInteger("lnSpcReduction", 0);
            }
        }

        internal override void WriteXmlCore(WriteContext context)
        {
            using (WriteContext c = context.Write("normAutofit"))
            {
                c.SetOptionalInteger("fontScale", FontScale, 100000);
                c.SetOptionalInteger("lnSpcReduction", LineSpaceReduction, 0);
            }
        }
    }
}